package operation;

import book.Book;
import book.BookList;

public class ReturnOperation implements IOperation{
    @Override
    public void work(BookList bookList) {
        System.out.println("归还图书");


        System.out.println("请输入你要归还的书籍：");
        String name = scanner.next();

        for (int i = 0; i < bookList.getUsedSize(); i++) {
            Book book = bookList.getBook(i);
            //看这本书是否一样
            if(book.getName().equals(name)){
                //System.out.println("查找到了这本书");
                book.setBorrowed(false);
                System.out.println("归还成功");
                return;
            }
        }
    }
}
